<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MTB CAT1 Peripheral driver library: PWM (TCPWM)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="IFXCYP_one-line.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">MTB CAT1 Peripheral driver library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__group__tcpwm__pwm.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#groups">API Reference</a>  </div>
  <div class="headertitle">
<div class="title">PWM (TCPWM)<div class="ingroups"><a class="el" href="group__group__tcpwm.html">TCPWM        (Timer Counter PWM)</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<p>Driver API for PWM. </p>
<p>The functions and other declarations used in this part of the driver are in cy_tcpwm_pwm.h. You can also include cy_pdl.h to get access to all functions and declarations in the PDL.</p>
<p>Use PWM mode when an output square wave is needed with a specific period and duty cycle, such as:</p><ul>
<li>Creating arbitrary square wave outputs</li>
<li>Driving an LED (changing the brightness)</li>
<li>Driving Motors (dead time assertion available)</li>
</ul>
<p>The PWM has the following features:</p><ul>
<li>16- or 32-bit Counter.</li>
<li>Two Programmable Period registers that can be swapped.</li>
<li>Two Output Compare registers that can be swapped on overflow and/or underflow.</li>
<li>Left Aligned, Right Aligned, Center Aligned, and Asymmetric Aligned modes</li>
<li>Continuous or One Shot run modes.</li>
<li>Pseudo Random mode.</li>
<li>Two PWM outputs with Dead Time insertion, and programmable polarity.</li>
<li>Interrupt on Terminal Count and Compare or Capture 0. Interrupt on Compare or Capture 1 is only available in TCPWM Version 2.</li>
<li>Start, Reload, Stop, Swap (Capture), and Count Inputs.</li>
<li>Immediate Kill, Kill 0 Input, Kill 1 Input, PWM output on Disable, PWM outputs, PWM Dead Time Clocks, Taps Enabled. All these features are only available in TCPWM Version 2.</li>
<li>Multiple Components can be synchronized together for applications. such as three phase motor control.</li>
<li>Two programmable trigger outputs, trig_out0 and trig_out1 that generate a trigger on one of the following events Overflow, Underflow, Terminal Count, Compare Match 0/1, and PWM output. The available triggers are dependent on the PWM mode. All these features are only available in TCPWM Version 2.</li>
<li>Overflow, Underflow, and Compare(cc_match) trigger outputs are only available in TCPWM Version 1.</li>
<li>Second Compare Match (CC_MATCH1) event is only available in TCPWM Version 2.</li>
</ul>
<h1><a class="anchor" id="group_tcpwm_pwm_configuration"></a>
Configuration Considerations</h1>
<p>The PWM configuration can be divided to number of sequential steps listed below:</p><ul>
<li><a class="el" href="group__group__tcpwm__pwm.html#group_tcpwm_pwm_config">Configure PWM</a></li>
<li><a class="el" href="group__group__tcpwm__pwm.html#group_tcpwm_pwm_clock">Assign Clock Divider</a></li>
<li><a class="el" href="group__group__tcpwm__pwm.html#group_tcpwm_pwm_enable">Enable PWM</a></li>
<li><a class="el" href="group__group__tcpwm__pwm.html#group_tcpwm_pwm_start">Start PWM</a></li>
</ul>
<h2><a class="anchor" id="group_tcpwm_pwm_config"></a>
Configure PWM</h2>
<p>To configure PWM, provide the configuration parameters in the <a class="el" href="structcy__stc__tcpwm__pwm__config__t.html">cy_stc_tcpwm_pwm_config_t</a> structure. The Configuration structure can be modified through software, but if the configurator in ModusToolbox is used then the configuration structure will be updated with the users input. To initialize the driver, call <a class="el" href="group__group__tcpwm__functions__pwm.html#ga6440d2a9dc8d85056abd62556bee7f82">Cy_TCPWM_PWM_Init</a> function providing a pointer to the populated <a class="el" href="structcy__stc__tcpwm__pwm__config__t.html">cy_stc_tcpwm_pwm_config_t</a> structure.</p>
<p>For TCPWM V1 Configuration </p><div class="fragment"><div class="line">    <span class="comment">/* Scenario: there is need to initialize</span></div><div class="line"><span class="comment">     * the first (index = 0) PWM of the TCPWM0 block</span></div><div class="line"><span class="comment">     * with the below configuration settings</span></div><div class="line"><span class="comment">     */</span></div><div class="line">    <a class="code" href="structcy__stc__tcpwm__pwm__config__t.html">cy_stc_tcpwm_pwm_config_t</a> tcpwm_v1_pwm_config =</div><div class="line">    {</div><div class="line">        <span class="comment">/* .pwmMode               = */</span> <a class="code" href="group__group__tcpwm__pwm__modes.html#ga55368116802a4169ce0926c7283cdae7">CY_TCPWM_PWM_MODE_PWM</a>, <span class="comment">/* Simple PWM Mode */</span></div><div class="line">        <span class="comment">/* .clockPrescaler        = */</span> <a class="code" href="group__group__tcpwm__pwm__clk__prescalers.html#ga910d37fc9bb964bbeaa885b1c530ece9">CY_TCPWM_PWM_PRESCALER_DIVBY_4</a>, <span class="comment">/* Clk_counter = Clk_input / 4 */</span></div><div class="line">        <span class="comment">/* .pwmAlignment          = */</span> <a class="code" href="group__group__tcpwm__pwm__alignment.html#ga11be53f7e2d3b141f52d6ed2d7ef8c6a">CY_TCPWM_PWM_LEFT_ALIGN</a>, <span class="comment">/* PWM signal is left aligned, meaning it starts high */</span></div><div class="line">        <span class="comment">/* .deadTimeClocks        = */</span> 0UL, <span class="comment">/* dead time feature is disabled */</span></div><div class="line">        <span class="comment">/* .runMode               = */</span> <a class="code" href="group__group__tcpwm__pwm__run__modes.html#gae979ff949eef746fe7c44905897f43f9">CY_TCPWM_PWM_CONTINUOUS</a>, <span class="comment">/* Wrap around at terminal count. */</span></div><div class="line">        <span class="comment">/* .period0               = */</span> 99UL, <span class="comment">/* Period of 100 (0-99). Terminal count event when rolls over back to 0. */</span></div><div class="line">        <span class="comment">/* .period1               = */</span> 199UL, <span class="comment">/* Period of 200 (0-199). Terminal count event when rolls over back to 0. */</span></div><div class="line">        <span class="comment">/* .enablePeriodSwap      = */</span> <span class="keyword">true</span>, <span class="comment">/* period swapping feature is enabled */</span></div><div class="line">        <span class="comment">/* .compare0              = */</span> 33UL, <span class="comment">/* duty cycle 33% (with period 100) */</span></div><div class="line">        <span class="comment">/* .compare1              = */</span> 66UL, <span class="comment">/* duty cycle 33% (with period 200) */</span></div><div class="line">        <span class="comment">/* .enableCompareSwap = */</span> <span class="keyword">true</span>, <span class="comment">/* compare swapping feature is enabled */</span></div><div class="line">        <span class="comment">/* .interruptSources  = */</span> <a class="code" href="group__group__tcpwm__interrupt__sources.html#gab5db2da5edd94851eebb473325dd6324">CY_TCPWM_INT_ON_TC</a>, <span class="comment">/* interrupt will rise on terminal count */</span></div><div class="line">        <span class="comment">/* .invertPWMOut          = */</span> 0UL, <span class="comment">/* Not invert */</span></div><div class="line">        <span class="comment">/* .invertPWMOutN         = */</span> 0UL, <span class="comment">/* Not invert */</span></div><div class="line">        <span class="comment">/* .killMode              = */</span> <a class="code" href="group__group__tcpwm__pwm__kill__modes.html#gae48c28ac4f7eabcebfc72b197a089284">CY_TCPWM_PWM_STOP_ON_KILL</a>, <span class="comment">/* PWM stops counting on kill */</span></div><div class="line">        <span class="comment">/* .swapInputMode         = */</span> <a class="code" href="group__group__tcpwm__input__modes.html#ga0e441e0d42e07a5bffa0e0d4e9058a26">CY_TCPWM_INPUT_RISINGEDGE</a>, <span class="comment">/* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */</span></div><div class="line">        <span class="comment">/* .swapInput             = */</span> <a class="code" href="group__group__tcpwm__input__selection.html#ga86b8267d250e656f6e79fbd703bce944">CY_TCPWM_INPUT_0</a>,</div><div class="line">        <span class="comment">/* .reloadInputMode       = */</span> <a class="code" href="group__group__tcpwm__input__modes.html#ga0e441e0d42e07a5bffa0e0d4e9058a26">CY_TCPWM_INPUT_RISINGEDGE</a>, <span class="comment">/* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */</span></div><div class="line">        <span class="comment">/* .reloadInput           = */</span> <a class="code" href="group__group__tcpwm__input__selection.html#ga86b8267d250e656f6e79fbd703bce944">CY_TCPWM_INPUT_0</a>,</div><div class="line">        <span class="comment">/* .startInputMode        = */</span> <a class="code" href="group__group__tcpwm__input__modes.html#ga0e441e0d42e07a5bffa0e0d4e9058a26">CY_TCPWM_INPUT_RISINGEDGE</a>, <span class="comment">/* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */</span></div><div class="line">        <span class="comment">/* .startInput            = */</span> <a class="code" href="group__group__tcpwm__input__selection.html#ga86b8267d250e656f6e79fbd703bce944">CY_TCPWM_INPUT_0</a>,</div><div class="line">        <span class="comment">/* .killInputMode         = */</span> <a class="code" href="group__group__tcpwm__input__modes.html#ga0e441e0d42e07a5bffa0e0d4e9058a26">CY_TCPWM_INPUT_RISINGEDGE</a>, <span class="comment">/* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */</span></div><div class="line">        <span class="comment">/* .killInput             = */</span> <a class="code" href="group__group__tcpwm__input__selection.html#ga86b8267d250e656f6e79fbd703bce944">CY_TCPWM_INPUT_0</a>,</div><div class="line">        <span class="comment">/* .countInputMode        = */</span> <a class="code" href="group__group__tcpwm__input__modes.html#ga6f8ffc8c36941d7d44290147032fd33b">CY_TCPWM_INPUT_LEVEL</a>, <span class="comment">/* Set this input to LEVEL and 1 (high logic level) */</span></div><div class="line">        <span class="comment">/* .countInput            = */</span> <a class="code" href="group__group__tcpwm__input__selection.html#ga7369f85b221bf7c70e1a580daa6a6bef">CY_TCPWM_INPUT_1</a>, <span class="comment">/* So the PWM will be enabled forever */</span></div><div class="line">        <span class="comment">/* .swapOverflowUnderflow = */</span> <span class="keyword">false</span>, <span class="comment">/* Use default overflow/underflow behavior */</span></div><div class="line">    };</div><div class="line"></div><div class="line"><span class="preprocessor">    #define MY_TCPWM_PWM_NUM   (0UL)</span></div><div class="line"><span class="preprocessor">    #define MY_TCPWM_PWM_MASK  (1UL &lt;&lt; MY_TCPWM_PWM_NUM)</span></div><div class="line"></div><div class="line">    <span class="keywordflow">if</span> (<a class="code" href="group__group__tcpwm__enums.html#gga236beaba02c8a2a1c4eec981501e7270af9807d578257fa9f0d29cd86ef2c71ea">CY_TCPWM_SUCCESS</a> != <a class="code" href="group__group__tcpwm__functions__pwm.html#ga6440d2a9dc8d85056abd62556bee7f82">Cy_TCPWM_PWM_Init</a>(TCPWM0, MY_TCPWM_PWM_NUM, &amp;tcpwm_v1_pwm_config))</div><div class="line">    {</div><div class="line">        <span class="comment">/* Handle possible errors */</span></div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="comment">/* Enable the initialized PWM */</span></div><div class="line">    <a class="code" href="group__group__tcpwm__functions__pwm.html#ga802ebf3a49b1056e4bc5b057deb26e49">Cy_TCPWM_PWM_Enable</a>(TCPWM0, MY_TCPWM_PWM_NUM);</div><div class="line"></div><div class="line">    <span class="comment">/* Then start the PWM */</span></div><div class="line">    <a class="code" href="group__group__tcpwm__functions__common.html#gaafe86ec440bec9a2c23392f289cc3a8b">Cy_TCPWM_TriggerStart_Single</a>(TCPWM0, MY_TCPWM_PWM_NUM);</div></div><!-- fragment --><p> For TCPWM V2 Configuration </p><div class="fragment"><div class="line">    <span class="comment">/* Scenario: there is need to initialize</span></div><div class="line"><span class="comment">     * the first (index = 0) PWM of the TCPWM0 block</span></div><div class="line"><span class="comment">     * with the below configuration settings</span></div><div class="line"><span class="comment">     */</span></div><div class="line">    <a class="code" href="structcy__stc__tcpwm__pwm__config__t.html">cy_stc_tcpwm_pwm_config_t</a> tcpwm_v2_pwm_config =</div><div class="line">    {</div><div class="line">        <span class="comment">/* .pwmMode               = */</span> <a class="code" href="group__group__tcpwm__pwm__modes.html#ga55368116802a4169ce0926c7283cdae7">CY_TCPWM_PWM_MODE_PWM</a>, <span class="comment">/* Simple PWM Mode */</span></div><div class="line">        <span class="comment">/* .clockPrescaler        = */</span> <a class="code" href="group__group__tcpwm__pwm__clk__prescalers.html#ga910d37fc9bb964bbeaa885b1c530ece9">CY_TCPWM_PWM_PRESCALER_DIVBY_4</a>, <span class="comment">/* Clk_counter = Clk_input / 4 */</span></div><div class="line">        <span class="comment">/* .pwmAlignment          = */</span> <a class="code" href="group__group__tcpwm__pwm__alignment.html#ga11be53f7e2d3b141f52d6ed2d7ef8c6a">CY_TCPWM_PWM_LEFT_ALIGN</a>, <span class="comment">/* PWM signal is left aligned, meaning it starts high */</span></div><div class="line">        <span class="comment">/* .deadTimeClocks        = */</span> 0UL, <span class="comment">/* dead time feature is disabled */</span></div><div class="line">        <span class="comment">/* .runMode               = */</span> <a class="code" href="group__group__tcpwm__pwm__run__modes.html#gae979ff949eef746fe7c44905897f43f9">CY_TCPWM_PWM_CONTINUOUS</a>, <span class="comment">/* Wrap around at terminal count. */</span></div><div class="line">        <span class="comment">/* .period0               = */</span> 99UL, <span class="comment">/* Period of 100 (0-99). Terminal count event when rolls over back to 0. */</span></div><div class="line">        <span class="comment">/* .period1               = */</span> 199UL, <span class="comment">/* Period of 200 (0-199). Terminal count event when rolls over back to 0. */</span></div><div class="line">        <span class="comment">/* .enablePeriodSwap      = */</span> <span class="keyword">true</span>, <span class="comment">/* period swapping feature is enabled */</span></div><div class="line">        <span class="comment">/* .compare0              = */</span> 33UL, <span class="comment">/* duty cycle 33% (with period 100) */</span></div><div class="line">        <span class="comment">/* .compare1              = */</span> 66UL, <span class="comment">/* duty cycle 33% (with period 200) */</span></div><div class="line">        <span class="comment">/* .enableCompareSwap     = */</span> <span class="keyword">true</span>, <span class="comment">/* compare swapping feature is enabled */</span></div><div class="line">        <span class="comment">/* .interruptSources      = */</span> <a class="code" href="group__group__tcpwm__interrupt__sources.html#gab5db2da5edd94851eebb473325dd6324">CY_TCPWM_INT_ON_TC</a>, <span class="comment">/* interrupt will rise on terminal count */</span></div><div class="line">        <span class="comment">/* .invertPWMOut          = */</span> 0UL, <span class="comment">/* Not invert */</span></div><div class="line">        <span class="comment">/* .invertPWMOutN         = */</span> 0UL, <span class="comment">/* Not invert */</span></div><div class="line">        <span class="comment">/* .killMode              = */</span> <a class="code" href="group__group__tcpwm__pwm__kill__modes.html#gae48c28ac4f7eabcebfc72b197a089284">CY_TCPWM_PWM_STOP_ON_KILL</a>, <span class="comment">/* PWM stops counting on kill */</span></div><div class="line">        <span class="comment">/* .swapInputMode         = */</span> <a class="code" href="group__group__tcpwm__input__modes.html#ga0e441e0d42e07a5bffa0e0d4e9058a26">CY_TCPWM_INPUT_RISINGEDGE</a>, <span class="comment">/* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */</span></div><div class="line">        <span class="comment">/* .swapInput             = */</span> <a class="code" href="group__group__tcpwm__input__selection.html#ga86b8267d250e656f6e79fbd703bce944">CY_TCPWM_INPUT_0</a>,</div><div class="line">        <span class="comment">/* .reloadInputMode       = */</span> <a class="code" href="group__group__tcpwm__input__modes.html#ga0e441e0d42e07a5bffa0e0d4e9058a26">CY_TCPWM_INPUT_RISINGEDGE</a>, <span class="comment">/* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */</span></div><div class="line">        <span class="comment">/* .reloadInput           = */</span> <a class="code" href="group__group__tcpwm__input__selection.html#ga86b8267d250e656f6e79fbd703bce944">CY_TCPWM_INPUT_0</a>,</div><div class="line">        <span class="comment">/* .startInputMode        = */</span> <a class="code" href="group__group__tcpwm__input__modes.html#ga0e441e0d42e07a5bffa0e0d4e9058a26">CY_TCPWM_INPUT_RISINGEDGE</a>, <span class="comment">/* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */</span></div><div class="line">        <span class="comment">/* .startInput            = */</span> <a class="code" href="group__group__tcpwm__input__selection.html#ga86b8267d250e656f6e79fbd703bce944">CY_TCPWM_INPUT_0</a>,</div><div class="line">        <span class="comment">/* .killInputMode         = */</span> <a class="code" href="group__group__tcpwm__input__modes.html#ga0e441e0d42e07a5bffa0e0d4e9058a26">CY_TCPWM_INPUT_RISINGEDGE</a>, <span class="comment">/* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */</span></div><div class="line">        <span class="comment">/* .killInput             = */</span> <a class="code" href="group__group__tcpwm__input__selection.html#ga86b8267d250e656f6e79fbd703bce944">CY_TCPWM_INPUT_0</a>,</div><div class="line">        <span class="comment">/* .countInputMode        = */</span> <a class="code" href="group__group__tcpwm__input__modes.html#ga6f8ffc8c36941d7d44290147032fd33b">CY_TCPWM_INPUT_LEVEL</a>, <span class="comment">/* Set this input to LEVEL and 1 (high logic level) */</span></div><div class="line">        <span class="comment">/* .countInput            = */</span> <a class="code" href="group__group__tcpwm__input__selection.html#ga7369f85b221bf7c70e1a580daa6a6bef">CY_TCPWM_INPUT_1</a>, <span class="comment">/* So the PWM will be enabled forever */</span></div><div class="line">        <span class="comment">/* .swapOverflowUnderflow = */</span> <span class="keyword">false</span>, <span class="comment">/* Use default overflow/underflow behavior */</span></div><div class="line">        <span class="comment">/* .immediateKill       = */</span> <span class="keyword">false</span>,  <span class="comment">/* Specifies whether the kill event immediately deactivates the dt_line_out and dt_line_compl_out or with the next module clock */</span></div><div class="line">        <span class="comment">/* .tapsEnabled         = */</span> 0x00UL, <span class="comment">/* In pseudo random mode this sets the enabled taps.*/</span></div><div class="line">        <span class="comment">/* .compare2            = */</span> 33UL, <span class="comment">/* duty cycle 33% (with period 100) */</span></div><div class="line">        <span class="comment">/* .compare3            = */</span> 66UL, <span class="comment">/* duty cycle 33% (with period 200) */</span></div><div class="line">        <span class="comment">/* .enableCompare1Swap  = */</span> <span class="keyword">true</span>, <span class="comment">/* Not implemented yet*/</span></div><div class="line">        <span class="comment">/* .compare0MatchUp     = */</span> <span class="keyword">true</span>, <span class="comment">/* Not implemented yet*/</span></div><div class="line">        <span class="comment">/* .compare0MatchDown   = */</span> <span class="keyword">true</span>, <span class="comment">/* Not implemented yet*/</span></div><div class="line">        <span class="comment">/* .compare1MatchUp     = */</span> <span class="keyword">true</span>, <span class="comment">/* Not implemented yet*/</span></div><div class="line">        <span class="comment">/* .compare1MatchDown   = */</span> <span class="keyword">true</span>, <span class="comment">/* Not implemented yet*/</span></div><div class="line">        <span class="comment">/* .kill1InputMode      = */</span> <a class="code" href="group__group__tcpwm__input__modes.html#ga0e441e0d42e07a5bffa0e0d4e9058a26">CY_TCPWM_INPUT_RISINGEDGE</a>, <span class="comment">/* This input is NOT used, leave it in default s tate (CY_TCPWM_INPUT_RISINGEDGE = 0UL) */</span></div><div class="line">        <span class="comment">/* .kill1Input          = */</span> <a class="code" href="group__group__tcpwm__input__selection.html#ga86b8267d250e656f6e79fbd703bce944">CY_TCPWM_INPUT_0</a>,</div><div class="line">        <span class="comment">/* .pwmOnDisable        = */</span> <a class="code" href="group__group__tcpwm__pwm__output__on__disable.html#ga87530bb1de32700c51a788b8285e8684">CY_TCPWM_PWM_OUTPUT_HIGHZ</a>,     <span class="comment">/* Default High impedance mode*/</span></div><div class="line">        <span class="comment">/* .trigger0Event       = */</span> <a class="code" href="group__group__tcpwm__output__trigger__modes.html#ga80297cac01044cbf8ea2af92c902da7e">CY_TCPWM_CNT_TRIGGER_ON_DISABLED</a>, <span class="comment">/* Disable output trigger0 event generation*/</span></div><div class="line">        <span class="comment">/* .trigger1Event       = */</span> <a class="code" href="group__group__tcpwm__output__trigger__modes.html#ga80297cac01044cbf8ea2af92c902da7e">CY_TCPWM_CNT_TRIGGER_ON_DISABLED</a>, <span class="comment">/* Disable output trigger1 event generation*/</span></div><div class="line">        <span class="comment">/* .reloadLineSelect    = */</span> <span class="keyword">true</span>, <span class="comment">/* Configures how the reload line select */</span></div><div class="line">        <span class="comment">/* line_out_sel         = */</span> <a class="code" href="group__group__tcpwm__data__structures__pwm.html#ggab0adb8ee7ffc443e3ce016aec3d447c8a6c268b8864615e8ac0ff6086c7d5ad46">CY_TCPWM_OUTPUT_CONSTANT_0</a>,</div><div class="line">        <span class="comment">/* linecompl_out_sel      = */</span> <a class="code" href="group__group__tcpwm__data__structures__pwm.html#ggab0adb8ee7ffc443e3ce016aec3d447c8a6c268b8864615e8ac0ff6086c7d5ad46">CY_TCPWM_OUTPUT_CONSTANT_0</a>,</div><div class="line">        <span class="comment">/* line_out_sel_buff      = */</span> <a class="code" href="group__group__tcpwm__data__structures__pwm.html#ggab0adb8ee7ffc443e3ce016aec3d447c8a6c268b8864615e8ac0ff6086c7d5ad46">CY_TCPWM_OUTPUT_CONSTANT_0</a>,</div><div class="line">        <span class="comment">/* linecompl_out_sel_buff = */</span> <a class="code" href="group__group__tcpwm__data__structures__pwm.html#ggab0adb8ee7ffc443e3ce016aec3d447c8a6c268b8864615e8ac0ff6086c7d5ad46">CY_TCPWM_OUTPUT_CONSTANT_0</a>,</div><div class="line">        <span class="comment">/* deadTimeClocks_linecompl_out = */</span> 5U,</div><div class="line">    };</div><div class="line"></div><div class="line"><span class="preprocessor">    #define MY_TCPWM_PWM_NUM   (0UL)</span></div><div class="line"><span class="preprocessor">    #define MY_TCPWM_PWM_MASK  (1UL &lt;&lt; MY_TCPWM_PWM_NUM)</span></div><div class="line"></div><div class="line">    <span class="keywordflow">if</span> (<a class="code" href="group__group__tcpwm__enums.html#gga236beaba02c8a2a1c4eec981501e7270af9807d578257fa9f0d29cd86ef2c71ea">CY_TCPWM_SUCCESS</a> != <a class="code" href="group__group__tcpwm__functions__pwm.html#ga6440d2a9dc8d85056abd62556bee7f82">Cy_TCPWM_PWM_Init</a>(TCPWM0, MY_TCPWM_PWM_NUM, &amp;tcpwm_v2_pwm_config))</div><div class="line">    {</div><div class="line">        <span class="comment">/* Handle possible errors */</span></div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="comment">/* Enable the initialized PWM */</span></div><div class="line">    <a class="code" href="group__group__tcpwm__functions__pwm.html#ga802ebf3a49b1056e4bc5b057deb26e49">Cy_TCPWM_PWM_Enable</a>(TCPWM0, MY_TCPWM_PWM_NUM);</div><div class="line"></div><div class="line">    <span class="comment">/* Then start the PWM */</span></div><div class="line">    <a class="code" href="group__group__tcpwm__functions__common.html#gaafe86ec440bec9a2c23392f289cc3a8b">Cy_TCPWM_TriggerStart_Single</a>(TCPWM0, MY_TCPWM_PWM_NUM);</div></div><!-- fragment --> <h2><a class="anchor" id="group_tcpwm_pwm_clock"></a>
Assign Clock Divider</h2>
<p>The clock source must be connected to proper working. Any of the peripheral clock dividers could be used. Use the <a class="el" href="group__group__sysclk.html">SysClk (System Clock)</a> driver API to do that.</p>
<h2><a class="anchor" id="group_tcpwm_pwm_enable"></a>
Enable PWM</h2>
<p>PWM has to be enabled before starting</p>
<div class="fragment"><div class="line">    <span class="comment">/* Scenario: Enable PWM */</span></div><div class="line"><span class="preprocessor">    #define MY_TCPWM_PWM_NUM   (0UL)</span></div><div class="line"></div><div class="line">    <a class="code" href="group__group__tcpwm__functions__pwm.html#ga802ebf3a49b1056e4bc5b057deb26e49">Cy_TCPWM_PWM_Enable</a>(TCPWM0, MY_TCPWM_PWM_NUM);</div></div><!-- fragment --> <h2><a class="anchor" id="group_tcpwm_pwm_start"></a>
Start PWM</h2>
<p>PWM has to be started</p>
<div class="fragment"><div class="line">    <span class="comment">/* Scenario: Start PWM operation */</span></div><div class="line"><span class="preprocessor">    #define MY_TCPWM_PWM_NUM   (0UL)</span></div><div class="line"></div><div class="line">    <a class="code" href="group__group__tcpwm__functions__common.html#gaafe86ec440bec9a2c23392f289cc3a8b">Cy_TCPWM_TriggerStart_Single</a>(TCPWM0, MY_TCPWM_PWM_NUM);</div></div><!-- fragment --><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="groups"></a>
API Reference</h2></td></tr>
<tr class="memitem:group__group__tcpwm__macros__pwm"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__tcpwm__macros__pwm.html">Macros</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__tcpwm__functions__pwm"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__tcpwm__functions__pwm.html">Functions</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__tcpwm__data__structures__pwm"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__tcpwm__data__structures__pwm.html">Data Structures</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>MTB CAT1 Peripheral driver library</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
